/* ----------------------------------------------------------------------
*
* Copyright (C) 2025 XiaoFei. All rights reserved.
*
* $file:		XiaoZhi_Fire.h
* $Date:        31-January-2025
* $Revision: 	V1
* $Project: 	XiaoFei BSP Library
* $Taobao:      https://item.taobao.com/item.htm?abbucket=17&id=826653373478
*
* -------------------------------------------------------------------- */

#ifndef __XiaoZhi_Fire_H
#define __XiaoZhi_Fire_H

#define Fire_Use_DO

#if defined(Fire_Use_ADC2)||defined(Fire_Use_ADC1)
    #define Fire_RCC_AO					RCC_APB2Periph_GPIOA
    #define Fire_GPIO_AO				GPIOA
    #define Fire_PIN_AO					GPIO_Pin_1
    #define Fire_ADC_Channel			ADC_Channel_1
#endif      

#ifdef Fire_Use_DO
    #define Fire_RCC_DO					RCC_APB2Periph_GPIOA
    #define Fire_GPIO_DO				GPIOA
    #define Fire_PIN_DO					GPIO_Pin_1
    #define Fire_Trigger				Bit_RESET
#endif

/* 
* @function: 	Fire_Init
*/
void Fire_Init(void);

#if defined(Fire_Use_ADC2)||defined(Fire_Use_ADC1)
/* 
* @function: 	Fire_GetValue
* @return:		The ADC value from fire sensor. This value will be mapped from 0 to 3.3 volts to 0 to 4096.
*/
unsigned int Fire_GetValue(void);
#endif

#if defined(Fire_Use_ADC2)||defined(Fire_Use_ADC1)
/* 
* @function: 	Fire_GetVoltage
* @return:		The Voltage value from fire sensor. This value need to be limited to 0 to 3.3 volts.
*/
float Fire_GetVoltage(void);
#endif

#ifdef Fire_Use_DO
/* 
* @function: 	Fire_IsTrigger
* @return:		Return 0x01 if the fire sensor is trigger.
*/
unsigned char Fire_IsTrigger(void);
#endif

#endif


